<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/vue@2"></script>
    <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
    <script src="https://unpkg.com/element-ui/lib/index.js"></script>
</head>
<body>
<div id="app">
    <div class="demo-input-size">
        <el-input
                size="medium"
                placeholder="请输入科室名"
                suffix-icon="el-icon-date"
                style="display: inline-block;width: 200px;"
                v-model="searchInfo.kname"
        >
        </el-input>
        <el-button icon="el-icon-search" type="success"  @click="searchKes()">搜索科室</el-button>
        <el-table
                :data="kesArr"
                border
                style="width: 100%">
            <el-table-column
                    prop="id"
                    label="编号"
                    width="80">
            </el-table-column>
            <el-table-column
                    prop="kname"
                    label="科室名称"
            >
            </el-table-column>
            <el-table-column
                    prop="state"
                    label="科室状态">

            </el-table-column>
        </el-table>
        <el-pagination
                background
                @current-change="handleCurrentChange"
                layout="prev, pager, next"
                :total="totalCount">
        </el-pagination>
    </div>
</div>
<script>
    var danghui = new Vue({
        el: "#app",
        data: {
            searchInfo: {},
            kesArr: [],
            totalCount: 0,
        },
        methods: {

            searchKes() {
                getData(1, 10);
            },
            handleCurrentChange(val) {
                getData(val, 10)
            }
        }
    });

    function getData(a, b) {
        danghui.searchInfo.pageNo = a;
        danghui.searchInfo.pageCount = b;
        $.post("/ssm/kes/query", danghui.searchInfo, function (backData) {
            danghui.kesArr = backData.data.currentData;
            danghui.totalCount = backData.data.totalCount;
        });
    }

    getData(1, 10);

</script>
</body>
</html>